package com.bruce.starts.demo.guava.throwables;

import com.google.common.base.Throwables;

import java.sql.SQLException;

public class ThrowablesTest {
    public static void main(String[] args) {
        testThrowablesGetCausalChain();
    }
    public static void testThrowablesGetCausalChain() {
        try {
            try {
                try {
                    throw new RuntimeException("Inner Most exception");
                } catch (Exception e) {
                    throw new SQLException("Middle tier exception", e);
                }
            } catch (Exception e) {
                throw new IllegalStateException("Last exception", e);
            }
        } catch (Exception e) {
            System.out.println(Throwables.getCausalChain(e));
        }
    }
}
